/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package org.fyx.mula.entity;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Embeddable;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;

/**
 *
 * @author ydenek
 */
@Embeddable
public class MulaTranslatePK implements Serializable {
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 255)
    @Column(name = "_key")
    private String key;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 3)
    @Column(name = "iso_language")
    private String isoLanguage;

    public MulaTranslatePK() {
    }

    public MulaTranslatePK(String key, String isoLanguage) {
        this.key = key;
        this.isoLanguage = isoLanguage;
    }

    public String getKey() {
        return key;
    }

    public void setKey(String key) {
        this.key = key;
    }

    public String getIsoLanguage() {
        return isoLanguage;
    }

    public void setIsoLanguage(String isoLanguage) {
        this.isoLanguage = isoLanguage;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (key != null ? key.hashCode() : 0);
        hash += (isoLanguage != null ? isoLanguage.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof MulaTranslatePK)) {
            return false;
        }
        MulaTranslatePK other = (MulaTranslatePK) object;
        if ((this.key == null && other.key != null) || (this.key != null && !this.key.equals(other.key))) {
            return false;
        }
        if ((this.isoLanguage == null && other.isoLanguage != null) || (this.isoLanguage != null && !this.isoLanguage.equals(other.isoLanguage))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "org.fyx.mula.entity.MulaTranslatePK[ key=" + key + ", isoLanguage=" + isoLanguage + " ]";
    }
    
}
